#ifndef _H_TILE_RENDER_
#define _H_TILE_RENDER_
#include <Kharlia/Client/Common.h>
#include <vector>
#include <iostream>

namespace Kharlia { namespace Client {
    class Engine;

    struct Tile {
        Tile(int x=4, int y=4): X(x), Y(y) { }
        int X,Y;
    };

    class TileRender
    {
    public:
        TileRender::TileRender(boost::shared_ptr<Engine> engine, uint32 width, uint32 height,
                               uint32 tileWidth, uint32 tileHeight, const std::string& tileSet);
        ~TileRender();

        void UpdateTile(uint32 ix, uint32 iy,uint32 newx, uint32 newy);
        void Draw();
    private:
        uint32 mLevelWidth; // in tiles
        uint32 mLevelHeight; // in tiles
        uint32 mTileXWidth; // in pixels
        uint32 mTileYHeight; // in pixels
        bool mValid;
        std::string mTileset;
        std::vector<Tile> mTileVector;

        CEGUI::Texture* mTileTexture;
        boost::weak_ptr<Engine> mEngine;
    };

} }

#endif
